﻿namespace DomainServices.Tools
{
    using System;
    using System.ComponentModel.DataAnnotations;

    internal class CustomValidationCustomAttributeBuilder : ValidationCustomAttributeBuilder
    {
        public override AttributeDeclaration GetAttributeDeclaration(Attribute attribute)
        {
            CustomValidationAttribute attribute2 = (CustomValidationAttribute) attribute;
            attribute2.FormatErrorMessage(string.Empty);
            AttributeDeclaration attributeDeclaration = base.GetAttributeDeclaration(attribute);
            attributeDeclaration.RequiredTypes.Add(attribute2.ValidatorType);
            attributeDeclaration.RequiredMethods.Add(attribute2.ValidatorType.GetMethod(attribute2.Method));
            return attributeDeclaration;
        }
    }
}

